import React from 'react';
import { BrowserRouter, NavLink, Route } from 'react-router-dom';
// 子组件
const Book = props => {
  const { match } = props;
  const { params } = match;
  console.log(props);
  return (
    <div>
      <h1>{params.id}小说</h1>
    </div>
  );
};
const Index = () => {
  return (
    <BrowserRouter>
      <NavLink to="/book/1">小说1</NavLink>
      <NavLink to="/book/2">小说2</NavLink>
      <NavLink to="/book/3">小说3</NavLink>
      <Route path="/book/:id" component={Book} />
    </BrowserRouter>
  );
};
export default Index;
